home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / swtools / trubasic / rolldemos / chooser / ipmenu.tru < prev    next >
Text File  |  1994-08-02  |  2KB  |  66 lines

  1. external
  2. ! main menu loop for ip demos
  3. module ip
  4. DECLARE PUBLIC ippts(,),iptxt$()
  5. sub ip_demos
  6.  
  7.     call draw_ip
  8.     call waitup
  9.     do
  10.         call getclick_ip(op)
  11.     if op=1 then
  12.          chain "!cd ../demos/ip;../../basic/gltru -i alternate.tru &",return
  13.     elseif op=2 then
  14.            chain "!cd ../demos/ip;../../basic/gltru -i flip.tru &",return
  15.     elseif op=3 then 
  16.          chain "!cd ../demos/ip;../../basic/gltru -i aboutip.tru &",return
  17.     elseif op=4 then 
  18.         chain "!cd ../demos/ip;../../basic/gltru -i shift_brownian.tru &",return
  19.     elseif op=0 then
  20.         exit sub
  21.     end if
  22.     if op<>0 and op<>-1 then
  23.                 call expand(ippts(op,1),ippts(op,2),ippts(op,3),ippts(op,4))
  24.    draw textbox(ippts(op,1),ippts(op,2),ippts(op,3),ippts(op,4),iptxt$(op))
  25.                 call waitup
  26.         pause 3
  27.               call unexpand(ippts(op,1),ippts(op,2),ippts(op,3),ippts(op,4))
  28.    draw textbox(ippts(op,1),ippts(op,2),ippts(op,3),ippts(op,4),iptxt$(op))
  29.     end if
  30.  
  31.     if refresh(1)=1 then 
  32.         call draw_ip
  33.     end if
  34.     loop
  35. end sub
  36.  
  37. sub draw_ip
  38.         let u=ubound(ippts,1)
  39.         clear
  40.         for i=1 to u
  41.                 draw ipbox(i)
  42.         next i
  43.         box keep 0,1,0,1 in ipbox$
  44. end sub
  45.  
  46. picture ipbox(op)
  47.     draw box(ippts(op,1),ippts(op,2),ippts(op,3),ippts(op,4),op)
  48.    draw textbox(ippts(op,1),ippts(op,2),ippts(op,3),ippts(op,4),iptxt$(op))
  49. end picture
  50.  
  51. sub getclick_ip(op)
  52.         get mouse x,y,state
  53.         let op=-1
  54.         if state<>0 and x>=0 and x<=1 and y>=0 and y<=1 then
  55.            let u=ubound(ippts,1)
  56.        let op=0
  57.            for i=1 to u
  58.                 if x>ippts(i,1) and x<ippts(i,2) and y>ippts(i,3) and y<ippts(i,4) then
  59.                         let op=i
  60.                         exit sub
  61.                 end if
  62.            next i
  63.         end if
  64. end sub
  65. end module
  66.